﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Godot.core
{
    public class ResourceCache
    {
        internal static Dictionary<string, Resource> __resources = new Dictionary<string, Resource>();

        internal static void clear()
        {
        }

        public static void reload_externals()
        {
        }

        public static bool has(string p_path)
        {
            //GLOBAL_LOCK_FUNCTION

            return __resources.ContainsKey(p_path);
        }

        public static Resource get(string p_path)
        {
            //GLOBAL_LOCK_FUNCTION

            Resource res = __resources[p_path];
            return res;
        }

        public static void dump(string p_file = "", bool p_short = false) { }

        public static void get_cached_resources(ref List<Resource> p_resources)
        {
            foreach (KeyValuePair<string, Resource> E in __resources)
            {
                p_resources.Add(E.Value);
            }
        }

        public static int get_cached_resource_count()
        {
            return __resources.Count;
        }
    }
}
